﻿<navigation:Page x:Class="Slex.Lib.Demo.Views.Demos.EventStoryBoardMethodAction" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"      
           xmlns:slex="clr-namespace:Slex.Lib.Interactions;assembly=Slex.Lib"                       
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="EventStoryBoardMethodAction Page">
    <i:Interaction.Triggers>
        <slex:EventTrigger EventName="KeyUp">
            <slex:InvokeMethodAction MethodName="Begin" TargetType="Element" ElementName="myStoryboard">
                <slex:InvokeMethodAction.Conditions>
                    <slex:InvokingConditions>
                        <slex:InvokingCondition Property="Argument.Key" Value="A"/>
                    </slex:InvokingConditions>
                </slex:InvokeMethodAction.Conditions>
            </slex:InvokeMethodAction>
            <slex:InvokeMethodAction MethodName="Stop" TargetType="Element" ElementName="myStoryboard">
                <slex:InvokeMethodAction.Conditions>
                    <slex:InvokingConditions>
                        <slex:InvokingCondition Property="Argument.Key" Value="B"/>
                    </slex:InvokingConditions>
                </slex:InvokeMethodAction.Conditions>
            </slex:InvokeMethodAction>
        </slex:EventTrigger>
    </i:Interaction.Triggers>

    <Grid x:Name="LayoutRoot">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="0">
            <TextBlock FontSize="12" Padding="2" Text="Invoking methods of an element"/>
        </StackPanel>
        <StackPanel Grid.Row="1">

            <StackPanel.Resources>
                <!-- Animates the rectangle's opacity. -->
                <Storyboard x:Name="myStoryboard">
                    <DoubleAnimation
                      Storyboard.TargetName="MyAnimatedRectangle"
                      Storyboard.TargetProperty="Width"
                      From="100" To="400" Duration="0:0:1" 
                      />
                </Storyboard>
            </StackPanel.Resources>

            <Rectangle
      x:Name="MyAnimatedRectangle"
      Width="100" Height="100" Fill="Blue" />
        </StackPanel>
       
        


    </Grid>
</navigation:Page>
